]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
iconGrid: Always call findBestModeForSize()
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Thu, 9 Jun 2022 18:40:21 +0000 (15:40 -0300)
committerMarge Bot <marge-bot@gnome.org>
Wed, 10 Aug 2022 15:16:36 +0000 (15:16 +0000)
The API surface of IconGrid was originally meant to be only
setGridModes(), however findBestModeForSize() ended up being
called by AppDisplay code. Now that FolderGrid sets the modes
correctly, we don't need to skip calling findBestModeForSize()
anymore.

Always call findBestModeForSize() during IconGrid's allocation.
Add an underscore to findBestModeForSize() since it's now back
to be a private method of IconGrid.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>

js/ui/iconGrid.js

index a5f86fc64daaa0040b5a2829385e5012d943286d..ac8d3ecaafc8c26aed1cb7bb8fc688c16b88664b 100644 (file)
@@ -1180,7 +1180,7 @@ var IconGrid = GObject.registerClass({
         }
     }
 
-    findBestModeForSize(width, height) {
+    _findBestModeForSize(width, height) {
         const { pagePadding } = this.layout_manager;
         width -= pagePadding.left + pagePadding.right;
         height -= pagePadding.top + pagePadding.bottom;
@@ -1208,7 +1208,9 @@ var IconGrid = GObject.registerClass({
     }
 
     vfunc_allocate(box) {
-        this.layout_manager.adaptToSize(...box.get_size());
+        const [width, height] = box.get_size();
+        this._findBestModeForSize(width, height);
+        this.layout_manager.adaptToSize(width, height);
         super.vfunc_allocate(box);
     }